﻿<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>网页颜色选取插件colorpicker.js www.bootstrapmb.com</title>
	<link rel="stylesheet" href="./colorpicker.css">
	<script src="./colorpicker.js"></script>
	<style>
		* {
			margin: 0;
			padding: 0;
		}
        .pickerBox{ max-width: 1200px; margin: 100px auto; }
		.picker {
			width: 30px;
			height: 30px;
			cursor: pointer;
		}
	</style>
</head>
<body>
	<div class="pickerBox">
		点击这里获取颜色
		<div class="picker" id="color-picker"></div>
	</div>
	
	<div class="pickerBox">
		点击这里获取颜色
		<div class="picker" id="color-picker2"></div>
	</div>
</body>
<script>
	var a = Colorpicker.create({
		el: "color-picker",
		color: "rgba(38, 166, 153, 0.8)",
		change: function (elem, rgba) {
			elem.style.backgroundColor = rgba;
		}
	})
	
	var b = Colorpicker.create({
		el: "color-picker2",
		color: "rgba(201, 78, 78, 0.8)",
		change: function (elem, rgba) {
			elem.style.backgroundColor = rgba;
		}
	})
</script>
</html>